<?php
class tpl_admin_index {
	function call ($toObj) {
		if (Y('Request.GET.Ajax') == 'on') return $toObj;

		Y('Document.load', 'yfwsys:admin/common/header');

		$body = $toObj->DOG_appendChild ('body');
		
		$con = $body->DOG_appendChild ('div');
		$con->addClass('container');

		Y('Document.load', 'YFWsys:admin/common/title', $con);

		$AdminMenu = $con->DOG_appendChild ('div')->addClass('AdminMenu')->DOG_appendChild('ul');
		$OpenMenu = Y('Request.Global.Act');

		foreach ((array)Y('Module.List.YFWsys.Admin.ModInfo') as $Module=>$Menu) {
			if (empty ($Menu['admin']['adminmenu'])) continue;

			$MenuItem = $AdminMenu->DOG_appendChild ('li')->append('<a href="'.Y('Route.Path').'/'.$Menu['admin']['adminmenu']['link'].'">'.$Menu['admin']['adminmenu']['title'].'</a>');

			if (strcasecmp($OpenMenu, $Module) === 0) $MenuItem->addClass('selected open');

			$MenuItem = $MenuItem->DOG_appendChild('ul');

			foreach ($Menu['admin']['adminmenu'] as $Key=>$Val) {
				if (!is_numeric($Key)) continue;
				$MenuItem->DOG_appendChild ('li')->append('<a href="'.Y('Route.Path').'/'.$Val['link'].'">'.$Val['title'].'</a>');
			}
		}
		
		$Main = $con->DOG_appendChild('div')->addClass('AdminMain');

		$Main->DOG_appendChild('h2')->text('管理メニュー');

		$Main->DOG_appendChild('p')->text('メニューを選択してください。');

		Y('Document.load', 'yfwsys:admin/common/footer', $con);
		
		return $Main;

	}
}
?>